<template>
  <div class="icon" @click="changIcon">
    <!-- <component :is="status ? Expand : Fold" /> -->
    <el-icon v-show="!status"><Fold /></el-icon>
    <el-icon v-show="status"><Expand /></el-icon>
  </div>
</template>

<script setup lang="ts">
import { computed } from "@vue/runtime-core";
import { useStore } from "../../store/index"; //1、
const store = useStore(); //2、
let status = computed(()=>{//3、获取值
  return store.getters['getCollapse']
});
//4、修改vuex中的collapse
const changIcon = () =>{
    store.commit('setCollapse',!status.value)
}
</script>
c
<style scoped>
.icon {
  height: 26px;
  font-size: 24px;
  cursor: pointer;
  margin-right: 15px;
}
</style>